﻿using ReflectionStudio.Core.Events;
using System;
using System.Collections;
using System.Data;
using System.Data.OracleClient;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Linq;
namespace INTEX.DataBase.Tools
{
    public partial class INTEXDBC
    {
        public void GetStkWeight(DataRow rwb, ref double stkgrossw, ref double stkweight, ref Dictionary<string, string> makeup, ref  Dictionary<string, string> packup)
        {
            string AUFMSL = rwb["WBBAUFMSL"].ToString();
            string WBBAUFMSL = "0";
            double innerweight = 0;
            double outerweight = 0;
            if (AUFMSL.Trim().Length > 0)
            {
                AUFMSL = "00" + (AUFMSL + "                                     ").Substring(0, 21) + "V";
                if (makeup.ContainsKey(AUFMSL))
                {
                    WBBAUFMSL = makeup[AUFMSL];
                }
                else
                {
                    WBBAUFMSL = GetSDDAT("0114", AUFMSL).Substring(61, 8);
                    makeup.Add(AUFMSL, WBBAUFMSL);
                }
            }
            if (WBBAUFMSL.Trim() == "")
                innerweight = 0;
            else
            {
                innerweight = System.Convert.ToDouble(WBBAUFMSL) * 0.01;
            }
            string PACKTYP = rwb["WBBPACKTYP"].ToString();
            string WBBPACKTYP = "";
            if (PACKTYP.Trim().Length > 0)
            {
                PACKTYP = "00" + (PACKTYP + "                                     ").Substring(0, 21) + "V";
                if (packup.ContainsKey(PACKTYP))
                {
                    WBBPACKTYP = packup[PACKTYP];
                }
                else
                {
                    WBBPACKTYP = GetSDDAT("0258", PACKTYP).Substring(61, 8);
                    packup.Add(PACKTYP, WBBPACKTYP);
                }
            }
            if (WBBPACKTYP.Trim() == "")
                outerweight = 0;
            else
            {
                outerweight = System.Convert.ToDouble(WBBPACKTYP) * 0.01;
            }
            stkweight = System.Math.Round(0.001 * System.Convert.ToDouble(rwb["WBBIGEW"].ToString()), 1);
            stkgrossw = stkweight + innerweight + outerweight;
        }

    }
}

